<?php
/**
 * Created by PhpStorm.
 * User: 阿沁
 * Date: 2024/5/9
 * Time: 下午6:30
 * SOURCE: 中国大陆工时规管现况（标准工时）：
 *              一天工作时间为8小时，平均每周工时不超过40小时;
 *              加班上限为一天3小时及一个月36小时，逾时工作薪金不低于平日工资的150％。
 *              而一周最高工时则为48小时。平均每月计薪天数为21.75天。
 * TO: 我是阿沁,健康撸代码,拒绝通宵。
 * 版权所有: © 2024-2030 阿沁
 * WARNING: 未经本人许可, 禁止一切商用
 * CLASS: < Notify.php >
 */

namespace app\api\controller;

use app\admin\model\withdraw\UserWithdraw;
use app\common\controller\Api;
use app\common\library\Openapi;
use think\Log;

class Notify extends Api
{
	protected $noNeedLogin = ['*'];
	protected $noNeedRight = ['*'];
	
	function withdrawNotify()
	{
		
		$data = $this->request->param('data');
		$data = Openapi::desDecrypt($data);

		$data = json_decode($data);
		$order = UserWithdraw::where(['order_sn' => $data->requestId,'status'=>2])->find();
		if (!$order) {
			$this->error('找不到订单');
		}
		if ($data->status == 3) {
			$order->status = 4;
		} else {
			$order->status = 5;
			$order->reason = $data->failReason ?? '';
		}
		$order->save();
		$this->success();
	}
	
}